<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2016/10/16
 * Time: 15:13
 */
header('content-type:text/html;charset=utf-8');

$link=mysqli_connect('localhost','root','');

if(!$link){
    die('连接数据库失败!'.mysql_error());
}


mysqli_query($link,'set names utf8');
mysqli_query($link,'use `itcast`');



$fiedles=array('e_dept','date_of_entry');
$sql_order='';

$order=isset($_GET['order']) ? $_GET['order']:'';
$sort=isset($_GET['sort']) ? $_GET['sort']:'';

if($sort=='desc'){
    $sql_order="order by $order desc";
    $sort='asc';
}else{
    $sql_order="order by $order asc";
    $sort='desc';
}
$where='';
if(isset($_GET['keyword'])){
    $keyword=$_GET['keyword'];
    $keyword=mysqli_real_escape_string( $keyword);
    $where="where e_name like '%$keyword%'";
}

$page=1;
$lim=($page-1)*2;
$sql="select * from`emp_info`limit $lim,2";
$result=mysqli_query($link,$sql);
$page_html="<a href='./showList.php?page=1'首页</a>&nbsp;";

$sql ="select * form `emp_info` $sql_order ";
$result = mysqli_query($link,$sql);
$emp_info = array();
while($row=mysqli_fetch_assoc($result)){
    $emp_info[]=$row;
}
define('APP','itcast');
require './list_html_2.php';